﻿using UnityEngine;
using System.Collections;

public class TintLoop : MonoBehaviour
{

	public Color color;
	public float Duration;

	void Start ()
	{
		tk2dSprite sprite = GetComponent<tk2dSprite>();
		Hashtable options = new Hashtable();
		options.Add("from", sprite.color);
		options.Add("to", color);
		options.Add("time", Duration);
		options.Add("OnUpdate", "updateSpriteColor");
		options.Add("looptype", iTween.LoopType.pingPong);
		options.Add("easetype", iTween.EaseType.linear);
		iTween.ValueTo(gameObject, options);
	}

	void updateSpriteColor(Color color)
	{
		tk2dSprite sprite = GetComponent<tk2dSprite>();
		sprite.color = color;
	}


}